<!--
 * @Author: wjc
 * @Date: 2025-06-18 09:09:53
 * @LastEditors: wjc
 * @LastEditTime: 2025-09-25 17:06:38
 * @Description: 
-->
<template>
  <NiceMenu
    :accordion="accordion"
    :collapse="collapse"
    :default-active="(route.meta?.activePath as string) || route.path"
    :menus="menus"
    :rounded="rounded"
    :theme="theme"
    mode="vertical"
    @select="handleSelect"
  />
</template>

<script lang="ts" setup>
  import type { MenuProps } from '@nice/nice-ui'
  import type { MenuRecordRaw } from '@nice/types'

  import { useRoute } from 'vue-router'

  import { NiceMenu } from '@nice/nice-ui'

  import { useNavigation } from './use-navigation'

  interface Props extends MenuProps {
    collapse?: boolean
    menus?: MenuRecordRaw[]
  }

  defineOptions({
    name: 'LayoutLogoMenu',
  })

  withDefaults(defineProps<Props>(), {
    accordion: true,
    menus: () => [],
  })

  const route = useRoute()
  const { navigation } = useNavigation()

  async function handleSelect(key: string) {
    await navigation(key)
  }
</script>
